package test.test3;

import net.sf.cglib.proxy.Enhancer;

import javax.jws.Oneway;

public class ProxyFactory2 {
    public Object fangFa(String type){
        Enhancer enhancer=new Enhancer();
        if (type.equals("加")){
            enhancer.setSuperclass(Add.class);
            enhancer.setCallback(new CgLibProxy());
            Add o = (Add)enhancer.create();
            return o;
        }else if (type.equals("减")){
            enhancer.setSuperclass(Reduce.class);
            enhancer.setCallback(new CgLibProxy());
            Reduce o = (Reduce)enhancer.create();
            return o;
        }else if (type.equals("乘")){
            enhancer.setSuperclass(Ride.class);
            enhancer.setCallback(new CgLibProxy());
            Ride o = (Ride)enhancer.create();
            return o;
        }else if (type.equals("除")){
            enhancer.setSuperclass(Except.class);
            enhancer.setCallback(new CgLibProxy());
            Except o = (Except)enhancer.create();
            return o;
        }
       return null;
    }
}
